package com.learn.smart.framework.helper;

import java.util.Properties;

import com.learn.smart.framework.ConfigConstant;
import com.learn.smart.framework.util.PropsUtil;

public final class ConfigHelper {
		
	private static final Properties CONFIG_PROPS;
	
	private static String jspPathStart="/WEB-INF/view/";
	private static String jspPathEnd=".jsp";
	
	private static String assetPath="/asset/";
	
	static{
		CONFIG_PROPS = PropsUtil.loadProps(ConfigConstant.CONFIG_FILE);
	}
	
	public static void init(){
		System.out.println("读取配置文件");
	}
	
	public static Properties getProperties(){
		return CONFIG_PROPS;
	}
	
	/**
	 * @Title: getJdbcDriver 
	 * @author 林彬
	 * @Description: 获取驱动 
	 * @date 2017年5月4日 下午6:53:38 
	 * @return String   
	 * @throws
	 */
	public static String getJdbcDriver(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_DRIVER);
	}
	
	public static String getJdbcUserName(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_USERNAME);
	}
	
	public static String getJdbcPassword(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_PASSWORD);
	}
	
	public static String getJdbcUrl(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_URL);
	}
	
	public static String getAppBasePackage(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_BASE_PACKAGE);
	}
	
	public static String getAppJspPathStart(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_JSP_PATH,jspPathStart);
	}
	public static String getAppJspPathEnd(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_JSP_PATH,jspPathEnd);
	}
	
	public static String getAppAssetPath(){
		return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.APP_ASSET_PATH,assetPath);
	}

}
